package com.shanjupay.merchant.feign;

import com.shanjupay.common.domain.BusinessException;
import com.shanjupay.transaction.api.dto.PayChannelDTO;
import com.shanjupay.transaction.api.dto.PayChannelParamDTO;
import com.shanjupay.transaction.api.dto.PlatformChannelDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * TODO
 *
 * @Description
 * @Author zhangbing
 * @Date 2024/5/20 15:39 transaction-service2104
 **/
@FeignClient(value = "transaction-service2104")
public interface PlatformChannelFeign {

    //获取平台服务类型
    @GetMapping("/PlatformChanList")
    List<PlatformChannelDTO> queryPlatformChannel() throws BusinessException;

    /**
     * 为app绑定平台服务类型
     * @param appId 应用id
     * @param platformChannelCodes 平台服务类型列表
     */

    @PostMapping("/apps/{appId}/platformChannel")
    void bindPlatformChannelForApp(@PathVariable String appId,@RequestParam String platformChannelCodes) throws BusinessException;

    /**
     * 查看应用是否放到服务类型
     * @param appId
     * @param platformChannel
     * @return 绑定 1 否则 0
     * @throws BusinessException
     */
    @GetMapping("/merchant/apps/platformChannels")
    int queryAppBindPlatformChannel(@RequestParam String appId,@RequestParam String platformChannel) throws BusinessException;

    //获取原始支付渠道列表
    @GetMapping("/payChannel/platformChannel/{platformChannelCode}")
    List<PayChannelDTO> queryPayChannelByPlatFormChannel(@PathVariable String platformChannelCode);
    //保存支付渠道参数配置
    @PostMapping("/payChannelParams")
    public void savePayChannelParam(@RequestBody PayChannelParamDTO payChannelParamDTO);

    @GetMapping("/payChannelParams/apps/{appId}/platformChannels/{platformChannel}")
    List<PayChannelParamDTO> queryPayChannelParambyAppIdPlatformChannel(@PathVariable String appId,@PathVariable String platformChannel);

    @GetMapping("/payChannelParams/apps/{appId}/platformChannels/{platformChannel}/payChannels/{payChannel}")
    PayChannelParamDTO queryParamByAppIdPlatformChannelAndpayChannel(@PathVariable String appId,@PathVariable String platformChannel,@PathVariable String payChannel);

}
